<?php
namespace app\decorate\model;
use app\BaseModel;
use think\facade\Db;



class StaffCase extends BaseModel
{
    //定义表名 文章表
    protected $name = 'longbing_card_decorate_staff_case';


    /**
     * @author chenniang
     * @DataTime: 2021-06-17 10:29
     * @功能说明:用户已经选择的数量
     */
    public function haveSelectNum($user_id){

        $dis = [

            'a.user_id' => $user_id,

            'b.status'  => 1
        ];

        $num = $this->alias('a')
               ->join('longbing_card_decorate_case b','a.case_id = b.id')
               ->where($dis)
               ->group('b.id')
               ->count();

        return $num;
    }


}